package com.example.demo.mapper;

import com.example.demo.entity.FollowInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface FollowMapper {

    /**
     * 判断当前用户是否关注 follow_id 用户
     * @param uid
     * @param followId
     * @return
     */
    Integer isFollow(@Param("uid") Integer uid,
                     @Param("follow_id") Integer followId);

    /**
     * 关注
     * @param uid
     * @param followId
     * @return
     */
    Integer select(@Param("uid") Integer uid,
                   @Param("follow_id") Integer followId);

    /**
     * 取消关注
     * @param uid
     * @param followId
     * @return
     */
    Integer cancel(@Param("uid") Integer uid,
                   @Param("follow_id") Integer followId);

    /**
     * 获取粉丝总数量
     * @return
     */
    Integer getFansByUid(@Param("follow_id") Integer uid);

    /**
     * 获取该 uid 的所有粉丝 id
     * @param uid
     * @return
     */
    List<FollowInfo> getFanInfoAllByUid(@Param("follow_id") Integer uid);

    /**
     * 根据 uid 获取关注列表
     * @param uid
     * @return
     */
    List<FollowInfo> getConcernListByUid(@Param("uid") Integer uid);
}
